package com.etc.user.controller;

import com.etc.entity.City;
import com.etc.result.CodeMsg;
import com.etc.result.Result;
import com.etc.service.impl.CityServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 文件名:com.etc.user.controller.CityController
 * 描述：城市控制器
 * 作者:吴仕泉
 * 时间:2019/5/26 16:28
 */
@Controller
@RequestMapping("city.action")
public class CityController {

    @Autowired
    CityServiceImpl cityService;

    //查询城市信息
    @RequestMapping("findCityByProNum")
    @ResponseBody
    public Result<City> findCityByPronum(Integer proNum){
        List<City> citys =  cityService.findCitysByProvId(proNum);
        if(citys == null){
            return Result.error(CodeMsg.REQUEST_ILLEGAL);
        }
        return Result.success(citys);
    }
}
